import 'package:flutter/material.dart';

class TapBoxA extends StatefulWidget {
  TapBoxA({Key key}): super(key:key);

  @override
  State<StatefulWidget> createState() => new _TapboxAState();
}

class _TapboxAState extends State<TapBoxA> {
  bool _active = false;

  void _handleTap() {
    setState(() {
     _active = !_active; 
    });
  }

  @override
  Widget build(BuildContext context) {
    return new GestureDetector(
      onTap: _handleTap,
      child: new Container(
        child: Center(
          child: new Text(
           _active ? '激活状态' : '失效状态',
           style: new TextStyle(fontSize: 30.0, color: Colors.white), 
          ),
        ),
        width: 100,
        height: 100,
        decoration: new BoxDecoration(
          color: _active ? Colors.lightGreen[700] : Colors.grey[600]
        ),
      ),
    );
  }
}